package com.liujit.pay.wx.enums;

import cn.hutool.core.util.StrUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @description: 优惠范围
 * @author: liujun
 * @create: 2021-02-22 14:42
 */
@Getter
@AllArgsConstructor
public enum PromotionScope {
    /**
     * 全场代金券
     */
    GLOBAL("GLOBAL", "全场代金券"),
    /**
     * 单品优惠
     */
    SINGLE("SINGLE", "单品优惠");

    private String scope;

    private String name;

    public static String getName(String scope) {
        for (PromotionScope promotionScope : PromotionScope.values()) {
            if (StrUtil.equals(scope, promotionScope.getScope())) {
                return promotionScope.getName();
            }
        }
        return null;
    }
}
